package com.gmg.model.city;

import org.json.JSONObject;

public class City {

	private static final int DEFAULT_CITY_NO_POPULATION = -1;
	
	private String 	name;
	private int 	population = DEFAULT_CITY_NO_POPULATION;

	public City(String pName) {
		name = pName;
	}

	public City(String pName, int pPopulation) {
		name = pName;
		population = pPopulation;
	}

	public City(JSONObject jsonObject) throws Exception {

		if (jsonObject.get("loginStatus").equals("yes")) {
			this.name = jsonObject.getString("cityName");
			this.population = jsonObject.getInt("cityPopulation");
		}

	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the population
	 */
	public int getPopulation() {
		return population;
	}

}
